package com.usian.feign;

import com.usian.CatResult;
import com.usian.PageResult;
import com.usian.pojo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "usian-item-service")
public interface ItemFeign {

    @RequestMapping("selectItemInfo")
    public TbItem selectItemInfo(@RequestParam(name = "itemId") Long itemId);
    //查询商品列表
    @RequestMapping("selectTbItemAllByPage")
    public PageResult selectTbItemAllByPage(@RequestParam("page") Integer page,
                                            @RequestParam("rows") Integer rows);

//根据节点id查询商品分类
    @RequestMapping("selectItemCategoryByParentId")
    public List<TbItemCat> selectItemCategoryByParentId(@RequestParam Long id);

//    根据id查询商品的规格分类
    @RequestMapping("selectItemParamByItemCatId/{itemCatId}")
    public TbItemParam selectItemParamByItemCatId(@PathVariable Long itemCatId);

//    添加商品
    @RequestMapping("insertTbItem")
    public Integer insertTbItem(@RequestBody TbItem tbItem,
                                @RequestParam String desc,
                                @RequestParam String itemParams);

//    商品信息回显
    @RequestMapping("preUpdateItem")
    public Map<String ,Object> preUpdateItem(@RequestParam Long itemId);

//    修改商品信息
    @RequestMapping("updateTbItem")
    public Integer updateTbItem(@RequestBody TbItem tbItem,
                                @RequestParam String desc,
                                @RequestParam String itemParams);

//    删除商品
    @RequestMapping("deleteItemById")
    public Integer deleteItemById(@RequestParam Long itemId);

//    查询所有商品规格模板
    @RequestMapping("selectItemParamAll")
    public PageResult selectItemParamAll(@RequestParam Integer page,@RequestParam Integer rows);

//    添加商品规格参数
    @RequestMapping("insertItemParam")
    public int insertItemParam(@RequestParam Long itemCatId,@RequestParam String paramData);

//    删除商品规格参数
    @RequestMapping("deleteItemParamById")
    public int deleteItemParamById(@RequestParam Long id);

//    首页查询分类列表
    @RequestMapping("selectItemCategoryAll")
    public CatResult selectItemCategoryAll();

//    获取商品详情描述
    @RequestMapping("/selectItemDescByItemId")
    TbItemDesc selectItemDescByItemId(@RequestParam Long itemId);

//    根据商品id查询商品规格参数
    @RequestMapping("/selectTbItemParamItemByItemId")
    TbItemParamItem selectTbItemParamItemByItemId(@RequestParam Long itemId);
}
